<%@ Language=VBScript %> <% Option Explicit %> <% Response.Buffer = false %> <% 'on error resume next dim rsproducts, strsql, ID, objImage, iheight, iwidth, iratio, rsTitle, iCount, fPrice, rsCheck dim rscategory, rsSettings, storefont, rsoptions, aroptions, counter, arprice dim ardiscounts, rsDiscount, discount_ID, arusers, a, p Dim iPageSize 'How big our pages are Dim iPageCount 'The number of pages we get back Dim iPageCurrent 'The page we want to show Dim iRecordsShown 'Loop controller for displaying just iPageSize records Dim I 'Standard looping var set rssettings = server.CreateObject("ADODB.Recordset") rssettings.CursorLocation = adUseClient strsql = "SELECT * FROM [Settings]" set rssettings = conn.execute(strsql) ' Get parameters iPageSize = rssettings("MaxProds") ' Retrieve page to show or default to 1 If Request.QueryString("page") = "" Then iPageCurrent = 1 Else iPageCurrent = CInt(Request.QueryString("page")) End If ID = Request.querystring("Category_ID") session("Category_ID") = ID strsql = "stor_get_products " & ID & "," & iPageSize & "," & iPageCurrent set rsProducts = server.CreateObject("ADODB.Recordset") rsProducts.CursorLocation = adUseCLient set rsProducts = conn.execute(strsql) iCount = rsProducts("theCount") iPageCount = iCount \ iPagesize + 1 set rsProducts = rsProducts.NextRecordset If iPageCurrent > iPageCount Then iPageCurrent = iPageCount If iPageCurrent < 1 Then iPageCurrent = 1 set rscategory = server.CreateObject("ADODB.Recordset") rscategory.CursorLocation = adUseClient strsql = "stor_Category_select_ID " & ID set rscategory = conn.execute(strsql) storefont = rssettings("StoreFontFace") set rsTitle = server.CreateObject("ADODB.RECORDSET") rsTitle.CursorLocation = adUseClient strsql = "stor_Meta_Tag_select " & ID set rsTitle = conn.execute(strsql) %> <% dim Meta_Title, Meta_Robots, Meta_Keywords if not rsTitle.EOF then Meta_Title = rsTitle("Meta_Title") Meta_Robots = rsTitle("Meta_Robots") Meta_Keywords = rsTitle("Meta_Keywords") end if %> <%if not rsTitle.EOF then response.Write(rstitle("Title"))%> <% rsTitle.Close set rsTitle = nothing %> size=2>
<% If iPageCount = 0 Then Response.Write "

No Products were found that matched your search query. Please try again." Else %>
<% 'rsproducts.AbsolutePage = iPageCurrent if len(rscategory("sm_image")) > 4 then Response.Write("

") else if len(rscategory("lg_image")) > 4 then Response.Write("

") end if end if 'if (len(rscategory("sm_image")) < 4 and len(rscategory("lg_image")) < 4) or (rscategory("sm_Image") = "" and rscategory("Lg_image") = "") then Response.Write("" & rsCategory("Name") & "") 'end if if rsCategory("long_desc") > "" then response.Write("

" & rsCategory("long_desc") & "

") end if Response.Write("

") %> <%if ipagecount > 1 then%> Page <%= iPageCurrent %> of <%= iPageCount %> <%end if%> <%irecordsShown = 0%> <%do while not rsproducts.EOF%> > <%iRecordsShown = iRecordsShown + 1%> <%rsproducts.MoveNext%> <%loop%>
<% if rsproducts("sm_image") > "" then 'get image size set objImage = server.CreateObject("IMGSIZE.CHECK") objIMage.FileName = Request.ServerVariables("APPL_PHYSICAL_PATH") & "store/images/" & rsProducts("sm_image") iheight = objImage.Height iwidth = objImage.Width if iwidth > 0 and iwidth > 80 then iratio = 80/iwidth iwidth = 80 else iratio = 1 end if %> &Category_ID=<%=rscategory("Category_ID")%>">" height="<%=cint(iheight*iratio)%>" width="<%=iwidth%>" alt="<%=rsproducts("Name")%>"> <% else if rsproducts("lg_image") > "" then 'get image size set objImage = server.CreateObject("IMGSIZE.CHECK") objIMage.FileName = Request.ServerVariables("APPL_PHYSICAL_PATH") & "store/images/" & rsProducts("lg_image") iheight = objImage.Height iwidth = objImage.Width if iwidth > 0 and iwidth > 80 then iratio = 80/iwidth iwidth = 80 else iratio = 1 end if %> &Category_ID=<%=rscategory("Category_ID")%>">" height="<%=cint(iheight*iratio)%>" width="<%=iwidth%>" alt="<%=rsproducts("Name")%>"> <% end if end if %> <%=rsproducts("Name")%><%if rsproducts("highlight") then Response.Write("   NEW!!!")%><%if rsproducts("Sale") then Response.Write("   ON SALE!!!")%>
<% if len(rsproducts("short_desc")) < 5 then dim strtemp strtemp = left(rsProducts("long_desc"),100) strtemp = strtemp & "..." Response.Write(strtemp) else Response.Write(rsproducts("short_desc")) end if %>
[&Category_ID=<%=rscategory("Category_ID")%>">More Info]
<%if rsproducts("ShowPrice") then%> <%if rsproducts("show_MSRP") then %> MSRP: <%=formatcurrency(rsproducts("MSRP"))%>
<%end if%> <% fPrice = rsProducts("retail_Price") set rsCheck = server.CreateObject("ADODB.RECORDSET") set rsCheck = conn.execute("stor_VendorCategoryCoefficient_Check " & rsProducts("vendor_ID") & "," & ID) if not rsCheck.EOF then fPrice = rsCheck("UserCoef") * rsProducts("Cost") end if rsCheck.Close %> Our Price: <%=formatcurrency(fPrice)%> <%'session("User_ID") = 4 'Check to see if any Product Level discounts apply if rsProducts("Discounts") > "" or len(rsProducts("Discounts")) > 1 then ardiscounts = split(rsProducts("Discounts"),",") if ubound(ardiscounts) <= 0 then discount_ID = cint(arDiscounts(0)) set rsDiscount = server.CreateObject("ADODB.RECORDSET") rsDiscount.CursorLocation = adUseClient set rsDiscount = conn.execute("stor_Discounts_select_ID " & discount_ID) do while not rsDiscount.eof if (rsDiscount("Type3") = 0 and rsDiscount("Type1") = 1 and rsDiscount("Type5") = 0) then 'Single item product-level discount available to all users Response.Write("Special: " & rsDiscount("Display")) end if if (rsDiscount("Type3") = 0 and rsDiscount("Type1") = 1 and rsDiscount("Type5") = 1) then 'Single item product-level discount available to selected users arusers = split(rsDiscount("Users"),",") if ubound(arusers) = 0 then if cint(session("User_ID")) = cint(arusers(0)) then Response.Write("Special: " & rsDiscount("Display")) end if else if ubound(arusers) > 0 then for a = lbound(arusers) to ubound(arusers) if cint(session("User_ID")) = cint(arusers(a)) then Response.Write("Special: " & rsDiscount("Display")) exit for end if next end if end if end if rsdiscount.movenext loop rsDiscount.Close set rsDiscount = nothing else 'Multiple Discounts for a single product for p = lbound(ardiscounts) to ubound(ardiscounts) discount_ID = ardiscounts(p) set rsDiscount = server.CreateObject("ADODB.RECORDSET") rsDiscount.CursorLocation = adUseClient set rsDiscount = conn.execute("stor_Discounts_select_ID " & discount_ID) if not rsDiscount.EOF then if (rsDiscount("Type3") = 0 and rsDiscount("Type1") = 1 and rsDiscount("Type5") = 0) then 'Single item product-level discount available to all users Response.Write("Special: " & rsDiscount("Display")) end if if (rsDiscount("Type3") = 0 and rsDiscount("Type1") = 1 and rsDiscount("Type5") = 1) then 'Single item product-level discount available to selected users arusers = split(rsDiscount("Users"),",") if ubound(arusers) = 0 then if cint(session("User_ID")) = cint(arusers(0)) then Response.Write("Special: " & rsDiscount("Display")) end if else if ubound(arusers) > 0 then for a = lbound(arusers) to ubound(arusers) if cint(session("User_ID")) = cint(arusers(a)) then Response.Write("Special: " & rsDiscount("Display")) exit for end if next end if end if end if end if rsDiscount.Close set rsDiscount = nothing next end if end if %> <%end if%>
<% if iPageCurrent > 1 then %> [<< Prev] <% end if ' Show Page Numbers if ipagecount > 1 then for I = 1 to iPageCount if I = iPageCurrent then %> <%= I %> <% else %> <%= I %> <% end if Next 'I if iPageCurrent < iPageCount then %> [Next >>] <% end if %>
Page <%= iPageCurrent %> of <%= iPageCount %> <%end if%> <%end if %>

 

<% Closers(rssettings) Closers(rsproducts) Closers(rsCategory) conn.close set conn = nothing %>